package cn.jiyun.client;

import cn.jiyun.pojo.User;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class UserClientFallbackFactory implements FallbackFactory<UserClient> {
    @Override
    public UserClient create(Throwable throwable) {
        return new UserClient() {
            @Override
            public User findByid(Long id) {
                log.error("查询用户异常", throwable);
                return new User();
            }

            @Override
            public List<User> all() {
                log.error("查询用户异常", throwable);
                return null;
            }

            @Override
            public void del(Long id) {
                log.error("查询用户异常", throwable);

            }

        };
    }
}
